<template>
	<view class="indexMod">
		<!-- 综治动态 -->
		<view class="zzNews">
			<view class="indexModTit spaceBet" @tap="goNewsList">
				<text>综治动态</text>
				<text class="iconfont icon-gengduo" v-if="hasNewsFlag == 1"></text>
			</view>
			<view class="newsList">
				<template v-if="hasNewsFlag == 1">
					<view class="listItem"
						v-for="(item,index) in newsList"
						:key="index"
						@tap="goZzNewsDet(item.id)"
					>
						<image class="newsImg" src="../../../static/images/index/news.png"></image>
						<view class="ellip">{{item.title}}</view>
					</view>
				</template>
				<template v-else-if="hasNewsFlag == 0">
					<view class="noNewsData">暂无新闻动态</view>
				</template>
			</view>
		</view>
		<view class="zzOhterMod">
			<view class="otherMod" @tap="goAnsQue">
				<view class="indexModTit spaceBet">
					<text>心理问答</text>
					<text class="iconfont icon-xlque"></text>
				</view>
				<view>说出你的疑惑</view>
			</view>
			<view class="otherMod" @tap="goJumpOhterXcx">
				<view class="indexModTit spaceBet">
					<text>心理课程</text>
					<text class="iconfont icon-course"></text>
				</view>
				<view>免费课程随便学</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			hasNewsFlag:Number,
			newsList:Array
		},
		methods:{
			goNewsList(){
				this.$emit('goNewsList');
			},
			goZzNewsDet(detId){
				uni.navigateTo({
					url:'/pages/subIndex/zzNews/newsDet?detId=' + detId
				})
			},
			goAnsQue(){
				uni.navigateTo({
					url:'/pages/subIndex/ansQueList/ansQueList'
				})
			},
			goJumpOhterXcx(){
				let userIdZz = uni.getStorageSync('userIdZz');
				let envVersion = process.env.NODE_ENV == 'development' ? 'trial' : 'release';	//打开版本  开发版 develop；体验版trial；		正式版release
				wx.navigateToMiniProgram({
					appId: 'wx6da88f4f8dae6118',
					path: `pages/index/index?userIdZz=${userIdZz}`,
					extraData: {},
					envVersion,
					success(res) {
						// 打开成功
					},
					fail(res){
						//打开失败
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.indexMod{
		padding: 20rpx 30rpx 0;
		display: flex;
		.zzNews{
			width: 368rpx;
			min-height: 130px;
			border: 1rpx solid #EEF7FF;
			padding: 5rpx 15rpx;
			border-radius: 16rpx;
			background: linear-gradient(0deg, #FFFFFF 0%, #EEF7FF 100%);
			margin-right: 15rpx;
			.noNewsData{
				height: 180rpx;
				line-height: 150rpx;
				font-size: 26rpx;
				text-align: center;
				color: $pss-text-color8;
			}
			.listItem{
				height: 60rpx;
				$comSize:40rpx;
				display: flex;
				align-items: center;
				font-size: 26rpx;
				color: $pss-text-color0;
				.newsImg{
					width: $comSize;
					height: $comSize;
					flex-shrink: 0;
				}
			}
		}
		.indexModTit{
			font-size: 32rpx;
			color: $pss-text-color0;
			font-weight: 600;
			align-items: center;
			height: 80rpx;
			.iconfont{
				color: $pss-color-blueDeep;
				&.icon-gengduo{
					font-size: 20rpx;
				}
				&.icon-xlque{
					font-size: 50rpx;
				}
				&.icon-course{
					font-size: 40rpx;
				}
			}
		}
		.zzOhterMod{
			flex:1;
			display: flex;
			flex-direction: column;
			.otherMod{
				flex: 1;
				background: #EEF7FF;
				border-radius: 16rpx;
				padding: 0 15rpx;
				font-size: 26rpx;
				color: $pss-color-blueDeep;
				&:first-child{
					margin-bottom: 15rpx;
				}
			}
		}
	}
</style>